import java.util.Arrays;

public class Text {
    public static void main(String[] args) {
        int[] array={1,2,3,4,5,6};
        array=func(array);
        String ret= Arrays.toString(array);
        System.out.println(ret);
    }
    public static int[] func(int[] array){
        int left=0;
        int right=array.length-1;
        while(left<right){
            for (int i = 0; i < array.length/2; i++) {
                if(left < right && array[left] %2 == 0){
                    int temp=array[left];
                    array[left]=array[right];
                    array[right]=temp;
                }
                left++;
                right--;
            }
        }
        return array;
    }
}
